export default {
    namespaced:true,
    state:{
        num:0
    },
    getters:{
        doubleNum(state){
            return  state.num * 2
        }
    },
    mutations:{
        increment(state){
            state.num++;
        },
        incrementN(state,{n}){
            state.num+= n;
        }
    },
    actions:{
        incrementWait({commit}){
            setTimeout(()=>{
                commit("increment")
            },1000)
        },
        incrementNWait({commit},payload){
            setTimeout(()=>{
                commit("incrementN",payload)
            },1000)
        }
    }
}